package cn.well.cloud.generator.engine.config;

import lombok.Data;

/**
 * Dao模板生成的配置
 *
 * @author fengshuonan
 * @date 2017-05-07 22:12
 */
@Data
public class DaoConfig {

    private ContextConfig contextConfig;

    private String daoPathTemplate;
    private String xmlPathTemplate;
    private String xmlExtPathTemplate;

    private String packageName;

    public void init() {
        this.daoPathTemplate = "\\src\\main\\java\\" + contextConfig.getProPackage().replaceAll("\\.", "\\\\") + "\\" + contextConfig.getModuleName() + "\\mapper\\\\{}Mapper.java";
        this.xmlPathTemplate = "\\src\\main\\java\\" + contextConfig.getProPackage().replaceAll("\\.", "\\\\") + "\\" + contextConfig.getModuleName() + "\\mapper\\mapping\\\\{}Mapper.xml";
        this.xmlExtPathTemplate = "\\src\\main\\java\\" + contextConfig.getProPackage().replaceAll("\\.", "\\\\") + "\\" + contextConfig.getModuleName() + "\\mapper\\mapping\\ext\\\\{}Mapper.xml";
        this.packageName = contextConfig.getProPackage() + "." + contextConfig.getModuleName() + ".mapper";
    }
}
